

package cs.remoteapp;
import java.io.Serializable;
/**
 * The Message class is a superclass that allows to factor the common
 * attributes of all messages sent and received by the application 
 * to another peer. 
 * The object is serializable to be encapsulated in a UDP or TCP packet.
 * <p>
 * Message object is characterized by  : 
 * <ul>
 * a user names
 * </ul>
 * and offers an API to determine the type of a message (Hello, Goodbye,....)
 * <p>
 * @author      4INFO - A1
 * @version     1.0
 */
public abstract class Message implements Serializable {
	/**
	 * Serialization id
	 */
	private static final long serialVersionUID = -643956532542065507L;
	
	/**
	 * the username of the chat system from which this message has been sent from (the sender username)
	 */
	private String username;
	
	/**
	 * constructor
	 * @param username the sender username 
	 */
	public Message(String username){
		this.username = username;
	}

	/**
	 * get the sender username
	 * @return username the username of the chat system from which this message has been sent from
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * set the sender username 
	 * @param username the sender username
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	
}
